Electronic device, charger within the electronic device, and detecting method for detecting abnormal status of connector of electronic device

ABSTRACT

An electronic device includes: a connector, arranged for coupling to a power supply external to the electronic device, wherein the power supply is arranged to provide a supply voltage to the electronic device to charge a battery of the electronic device; and a charger, coupled to the connector and selectively operated in a normal mode or a self-test mode, wherein when the charger operates in the normal mode, the charger is arranged for receiving the supply voltage via a power pin of the connector to charge the battery of the electronic device; and when the charger operates in the self-test mode, the charger provides a specific voltage to the power pin of the connector. The charger includes a detector to detect the current or voltage of at least one pin of the connector to generate a detecting result, and the supply voltage is set based on the detecting result.

CROSS REFERENCE TO RELATED APPLICATION

This application is a Continuation In Part of U.S. application Ser. No.15/006,129, which was filed on Jan. 26, 2016 and claims priority of U.S.Provisional Application No. 62/161,880, filed on May 14, 2015.

BACKGROUND

When a charger connector of an electronic device is damaged, foreignobjects such as dust, metal scraps or lead are present on the chargerconnector, or there is liquid between the charger connector pins, aleakage current generated when the electronic device is charged by apower adapter may cause a temperature of the charger connector toincrease, causing danger to the user.

In particular, because the leakage current is generated at the chargerconnector, a protection circuit within a charger IC within theelectronic device cannot provide adequate protection by detecting oravoiding this leakage current issue. In addition, because the leakagecurrent generally occurs when the cable of the power adapter connects tothe charger connector of the electronic device, and the leakage currentis seldom generated when no plug connects to the charger connector, howto design circuits to detect and protect the charger connector isdifficult, and is an important topic in this field.

SUMMARY

It is therefore an objective of the present invention to provide adetecting method for detecting abnormal status of the charger connectorof the electronic device, to solve the above-mentioned problems.

According to one embodiment of the present invention, an electronicdevice is provided comprising: a connector, arranged for coupling to apower supply external to the electronic device, wherein the power supplyis arranged to provide a supply voltage to the electronic device tocharge a battery of the electronic device; and a charger, coupled to theconnector and selectively operated in a normal mode or a self-test mode,wherein when the charger operates in the normal mode, the charger isarranged for receiving the supply voltage via a power pin of theconnector to charge the battery of the electronic device; and when thecharger operates in the self-test mode, the charger provides a specificvoltage to the power pin of the connector. The charger includes adetector to detect the current or voltage of at least one pin of theconnector to generate a detecting result, and the supply voltage is setbased on the detecting result.

According to another embodiment of the present invention, a charger isprovided, wherein the charger is arranged to be positioned in anelectronic device and coupled to a connector of the electronic device,and coupled to a power supply external to the electronic device. Thecharger is selectively operated in a normal mode or a self-test mode,wherein when the charger operates in the normal mode, the charger isarranged for receiving a supply voltage from the power supply via apower pin of the connector to charge a battery of the electronic device;and when the charger operates in the self-test mode, the chargerprovides a specific voltage to the power pin of the connector, whereinthe charger includes a detector to detect the current or voltage of atleast one pin of the connector to generate a detecting result, and thesupply voltage is set based on the detecting result.

According to another embodiment of the present invention, a detectingmethod of an electronic device is provided, wherein the electronicdevice comprises a connector arranged for coupling to a power supplyexternal to the electronic device, wherein the power supply is arrangedto provide a supply voltage to the electronic device via a power pin ofthe connector to charge a battery of the electronic device. Thedetecting method comprises: operating in a self-test mode and detectinga voltage or a current of at least one pin of the connector to generatea detecting result; and setting the supply voltage based on thedetecting result.

According to another embodiment of the invention, an electronic deviceis provided, and the electronic device comprises: a connector, arrangedfor coupling to a power supply external to the electronic device,wherein the power supply is arranged to provide a supply voltage to theelectronic device to charge a battery of the electronic device; acharger, coupled to the connector and selectively operated in a normalmode or a self-test mode, for receiving the supply voltage via a powerpin of the connector to charge the battery when the charger operates inthe normal mode; a transistor, having a gate electrode, a firstelectrode and a second electrode, wherein the gate electrode iscontrolled by a control signal provided by the charger, the firstelectrode is coupled to a ground pin of the connector, and the secondelectrode is coupled to a ground of the electronic device; and aresistor, coupled between the ground pin of the connector and the groundof the electronic device. When the charger operates in the self-testmode, the charger provides a specific voltage to the power pin of theconnector the charger includes a detector to detect the current orvoltage of at least one pin of the connector to generate a detectingresult, and the supply voltage is set based on the detecting result.

When the detecting result is within a first range, the supply voltage isset to be a first value, when the detecting result is within a secondrange, the supply voltage is set to be 5V, when the detecting result iswithin a third range, the supply voltage is set to be in a range between0 and 5V, and when the detecting result is above a threshold, the supplyvoltage is set to be 0V.

These and other objectives of the present invention will no doubt becomeobvious to those of ordinary skill in the art after reading thefollowing detailed description of the preferred embodiment that isillustrated in the various figures and drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram illustrating a charging system according to oneembodiment of the present invention.

FIG. 2 is a diagram illustrating a detailed structure of the electronicdevice according to one embodiment of the present invention.

FIG. 3 is a diagram illustrating a foreign object (i.e. resistor R1) onthe path between VBUS pin and GND pin.

FIG. 4 is a flowchart of a detecting method according to one embodimentof the present invention.

FIG. 5 shows the current detector shown in FIGS. 2 and 3 according toone embodiment of the present invention.

FIG. 6 is a diagram illustrating a foreign object (i.e. resistor R2) onthe path between VBUS pin and D+ pin.

FIG. 7 is a flowchart of a detecting method according to anotherembodiment of the present invention.

FIG. 8 shows a current path when the transistor Q1 is turned off.

DETAILED DESCRIPTION

Certain terms are used throughout the following description and claimsto refer to particular system components. As one skilled in the art willappreciate, manufacturers may refer to a component by different names.This document does not intend to distinguish between components thatdiffer in name but not function. In the following discussion and in theclaims, the terms “including” and “comprising” are used in an open-endedfashion, and thus should be interpreted to mean “including, but notlimited to . . . ” The terms “couple” and “couples” are intended to meaneither an indirect or a direct electrical connection. Thus, if a firstdevice couples to a second device, that connection may be through adirect electrical connection, or through an indirect electricalconnection via other devices and connections.

Please refer to FIG. 1, which is a diagram illustrating a chargingsystem 100 according to one embodiment of the present invention. Asshown in FIG. 1, the charging system 100 comprises a power supply (inthis embodiment, the power supply is an AC-DC adapter 110, but this isnot a limitation of the present invention, and the power source may be aUniversal Serial Bus (USB) host in other embodiments) and an electronicdevice 120, where the AC-DC adapter 110 is connected to the electronicdevice 120 via a cable 130, and the AC-DC adapter 110 provides at leasta supply voltage VBUS, aground voltage GND and data D+ and D− to theelectronic device 120. In this embodiment, the electronic device 120 maybe a portable device such as a cell phone, smart phone, tablet . . .etc. or any other electronic device required to be charged by a poweradapter or USB host.

The AC-DC adapter 110 comprises an AC-DC controller 112, a communicationunit 114 and a connector 118, where the AC-DC controller 112 is arrangedto receive external AC power to generate the stable supply voltage VBUS,the communication unit 114 is arranged to communicate with theelectronic device 120, and the connector 118 satisfies the USB standardsand has four pins for providing VBUS, D+, D− and GND. In addition, theelectronic device 120 comprises a controller 122, a communication unit123, a charger 124, a battery 125 and a connector 128. The controller122 is arranged to control the charger 124 and perform some operationsof the electronic device 120, and the charger 124 is arranged to chargethe battery 125 according to the supply voltage VBUS provided by theAC-DC adapter 110 or provide a specific voltage to the connector 128.The communication unit 123 is arranged to communicate with the AC-DCadapter 110, and the connector 128 satisfies the USB standards and hasfour pins for receiving VBUS, D+, D− and GND.

In this embodiment, the AC-DC controller 112 has a USB interface;however, the AC-DC controller 112 may have another interface such as USBpower delivery (USB PD), USB D+/D− or any other suitable interface inother embodiments. The circuits within the AC-DC adapter 110 may have aninter-integrated circuit (I2C) interface or a one wire (1-Wire)interface or any other suitable interface. In addition, the electronicdevice 120 has bi-directional communication with the AC-DC adapter 110.In this embodiment, the communication unit 116 and the communicationunit 123 may have any suitable wireless communication interface such asBluetooth (BT) or Bluetooth Low Energy (BT BLE).

Please refer to FIG. 2, which is a diagram illustrating a detailedstructure of the electronic device 120 according to one embodiment ofthe present invention. As shown in FIG. 2, the connector 128 comprises aVBUS pin 202 and a GND pin 208 (power pins) for receiving the supplyvoltage VBUS and the ground voltage GND, and a D+ pin 204 and a D− pin206 (data pins) for receiving data D+ and D− from the AC/DC adapter 110;the charger 124 comprises a voltage detector 222 and a booster 224; andthe electronic device 120 further comprises a current detector 210, atransistor Q1 and a resistor RT, where the gate electrode of thetransistor Q1 is coupled to a general purpose input/output (GPIO) pin, adrain electrode of the transistor Q1 is coupled to the power pin 208,and the source electrode of the transistor Q1 is coupled to a systemground; and the resistor RT is coupled between the power pin 208 and theGPIO pin. It is noted that FIG. 2 merely shows the elements related tothe present invention; a person skilled in the art should understandthat the electronic device 120 and the charger 124 have other elementsfor the general functions.

The elements shown in FIG. 2 are used to detect whether the connector128 has abnormal status, where the abnormal status is a leakage currentoccurred in the connector 128, and the leakage current may be caused byforeign objects such as dust, metal scraps, lead or liquid.Particularly, the detecting method can be implemented no matter whetherthe connector 128 is coupled to the AC/DC adapter 110 or not (i.e. nomatter whether the electronic device 120 is charged or not). Generally,the foreign object may be on a path between the VBUS pin 202 and GND pin208, or on a path between the VBUS pin 202 and one of the D+ pin 204 andD− pin 206, and the embodiments of detection methods for these two casesare provided in the following descriptions.

Refer to FIG. 3 and FIG. 4 together, where FIG. 3 is a diagramillustrating a foreign object (i.e. resistor R1) on the path betweenVBUS pin 202 and GND pin 208, and FIG. 4 is a flowchart of a detectingmethod according to one embodiment of the present invention. In Step402, the connector 128 does not couple to the AC/DC adapter 110 via thecable 130, the charger 124 operates in a first self-test mode, and thebooster 224 receives a battery voltage provided by the battery 125 andsends a specific voltage to the VBUS pin 202 of the connector 128. InStep 404, the current detector 210 detects a current of a path withinthe connector 128 or a path between the VBUS pin 202 and the charger 124to generate a detected current, where the current is generated accordingto the specific voltage. In Step 406, the booster 224 turns off thespecific voltage to save power. In Step 408, the current detector 210determines whether the detected current is greater than a threshold(e.g. 50 mA) or not. If the detected current is greater than thethreshold, the flow enters Step 422 to show a warning message, make anoise, or vibrate to notify the user that the connector 128 may sufferan overheating problem; and if the detected current is not greater thanthe threshold, the flow enters Step 410.

In Step 410, the charger 124 determines whether a power supply (e.g.cable of the power adapter or USB host) plugs into the connector 128. Ifyes, the flow enters Step 412; and if not, the flow enters Step 402again to periodically detect the abnormal status of the connector 128.In addition, in Step 412, because the connector 128 is coupled to theAC/DC adapter 110, and the VBUS pin 202 of the connector 128 has asupply voltage (e.g. 5V) provided by the AC/DC adapter 110, at this timethe booster 224 will receive the battery voltage provided by the battery125 and send a specific voltage greater than the supply voltage providedby the AC/DC adapter 110 to the VBUS pin 202. In detail, in Step 412,the voltage detector 222 detects a voltage level of the VBUS pin 202,and the booster 224 refers to the detected voltage level of the VBUS pin202 to generate the specific voltage by adding an offset, for example,if the detected voltage level of the VBUS pin 202 is 5V, the specificvoltage may be 5.3V or 5.5V. In addition, it is noted that the specificvoltage recited in Step 412 may be different from the specific voltagerecited in Step 402.

In Step 414, the current detector 210 detects a current of the pathwithin the connector 128 or the path between the VBUS pin 202 and thecharger 124 to generate a detected current, where the current isgenerated according to the specific voltage. In Step 416, the booster224 turns off the specific voltage to save power. In Step 418, thecurrent detector 210 determines whether the detected current is greaterthan a threshold (e.g. 50 mA) or not. If the detected current is greaterthan the threshold, the flow enters Step 422 to show a warning message,make a noise, or vibrate to notify the user that the connector 128 maysuffer an overheating problem; and if the detected current is notgreater than the threshold, the flow enters Step 420.

In Step 420, the charger 124 switches to operate in the normal mode,where the charger 124 receives the supply voltage provided by the AC/DCadapter via the cable 130 and the connector 128 to charge the battery125, then the flow enters Step 412 again to periodically detect theabnormal status of the connector 128. In addition, in Step 424, becausethe connector 128 may suffer an overheating problem, the charger 124 maynotify the controller 122 to communicate with the AC/DC adapter 110 todisable or reduce the supply voltage and/or supply current.

In more detail, the charger 124 can refer to the current detected inStep 414 to determine whether to disable or reduce the supply voltageand/or supply current, and can further refer to a range of the detectedcurrent to determine by how much the supply voltage and/or supplycurrent should be reduced. When the detected current falls within afirst range, the supply voltage and/or supply current can be set to be afirst value. When the detected current falls within a second range, thesupply voltage and/or supply current can be set to be 5V. When thedetected current falls within a third range, the supply voltage and/orsupply current can be set to be in a range between 0V and 5V. Finally,when the detected current is above a threshold (which may be differentfrom the threshold in Step 418), the charger 124 notifies the controller122 to communicate with the AC/DC adapter 110 to disable the supplyvoltage and/or supply current. Please note that the first range mayencompass at least one or both of the second range and third range.

FIG. 5 shows the current detector 210 shown in FIGS. 2 and 3 accordingto one embodiment of the present invention. As shown in FIG. 5, thecurrent detector 210 comprises a current source IS, a resistor RN, asubtractor 510 and a comparator 520. In detail, when the charger 124operates in the first self-test mode, the charger 120 generates thespecific voltage VB to the current source IS, and the subtractor 510calculates a voltage difference between two terminals of the resistorRN, where the voltage difference represents the current flowing throughthe resistor RN, VBUS pin 202, the resistor R1 and the GND pin 208.Then, the comparator compares the voltage difference with the thresholdVth to generate a detecting result OUT. It is noted that the embodimentshown in FIG. 5 is for illustrative purposes only, and not a limitationof the present invention. In other embodiments, the resistor RN can beplaced between the VBUS pin 202 and the GND pin 208, or placed on acurrent path flowing through the resistor R1.

Refer to FIG. 6 and FIG. 7 together, where FIG. 6 is a diagramillustrating a foreign object (i.e. resistor R2) on the path betweenVBUS pin 202 and D+ pin 204, and FIG. 7 is a flowchart of a detectingmethod according to another embodiment of the present invention. In Step702, the connector 128 does not couple to the AC/DC adapter 110 via thecable 130, the charger 124 operates in a second self-test mode, thetransistor Q1 is turned off (default status), and the booster 224receives a battery voltage provided by the battery 125 and sends aspecific voltage (e.g. 5V or 3.3V) to the VBUS pin 202 of the connector128. In Step 704, the voltage detector 222 detects the voltage level ofthe D+ pin 204. In Step 706, the voltage detector 222 determines whetherthe detected voltage is greater than a threshold (e.g. 3.3V) or not. Ifthe detected voltage is greater than the threshold, the flow enters Step716 to show a warning message, make a noise, or vibrate to notify theuser that the connector 128 may suffer an overheating problem; and ifthe detected voltage is not greater than the threshold, the flow entersStep 708.

In detail, if there is no foreign object between the VBUS pin 202 and D+pin 204, the resistor R2 does not exist, and the voltage level of the D+pin 204 should be small. If, however, there is no foreign object betweenthe VBUS pin 202 and D+ pin 204, a current path between the VBUS pin 202and the D+ pin 204 is generated due to the resistor R2, causing thehigher voltage level of the D+ pin 204. Therefore, by detecting thevoltage level of the D+ pin 204, the possible overheating problem can beknown and prevented.

In Step 708, the charger 124 determines whether a power supply (e.g.cable of the power adapter or USB host) plugs into the connector 128. Ifyes, the flow enters Step 710; and if not, the flow enters Step 702again to periodically detect the abnormal status of the connector 128.In addition, in Step 710, because the connector 128 is coupled to theAC/DC adapter 110, and the VBUS pin 202 of the connector 128 has asupply voltage (e.g. 5V) provided by the AC/DC adapter 110, at this timethe voltage detector 222 can directly detect the abnormal status of theconnector 128 by detecting the voltage level of the D+ pin 204 (i.e. thebooster 224 does not need to provide the specific voltage to the VBUSpin 202). In Step 712, the voltage detector 222 determines whether thedetected voltage is greater than the threshold (e.g. 3.3V) or not. Ifthe detected voltage is greater than the threshold, the flow enters Step716 to show a warning message, make a noise, or vibrate to notify theuser that the connector 128 may suffer an overheating problem; and ifthe detected voltage is not greater than the threshold, the flow entersStep 714.

In Step 714, the charger 124 switches to operate in the normal mode,where the charger 124 turns on the transistor Q1 to make the GND pin 208connect to the system ground of the electronic device 120. In addition,in Step 718, because the connector 128 may suffer an overheatingproblem, the charger 124 may notify the controller 122 to communicatewith the AC/DC adapter 110 to disable or reduce the supply voltageand/or supply current.

In more detail, the charger 124 can refer to the D+ pin voltage detectedin Step 710 to determine whether to disable or reduce the supply voltageand/or supply current, and can further refer to a range of the detectedvoltage to determine by how much the supply voltage and/or supplycurrent should be reduced. When the detected voltage falls within afirst range, the supply voltage and/or supply current can be set to be afirst value. When the detected voltage falls within a second range, thesupply voltage and/or supply current can be set to be 5V. When thedetected voltage falls within a third range, the supply voltage and/orsupply current can be set to be in a range between 0V and 5V. Finally,when the detected voltage is above a threshold (which may be differentfrom the threshold in Step 712), the charger 124 notifies the controller122 to communicate with the AC/DC adapter 110 to disable the supplyvoltage and/or supply current. Please note that the first range mayencompass at least one or both of the second range and third range.

In the embodiment shown in FIG. 6, the resistor R4 is designed to havelarge resistance (e.g. several mega ohms), and the transistor Q1 and theresistor R4 are arranged to limit the current flowing through the D+ pin204 and neighboring path to protect the connector 128 while the cable130 is plugged in. In detail, refer to FIG. 8. Initially, the transistorQ1 is turned off, and when the cable plugs in and the VBUS pin 202receives the supply voltage (e.g. 5V) provided by the AC/DC adapter 110,a current path 802 is from the VBUS pin 202, resistor R2, D+ pin 204,GPIO pin of the charger 124, system ground and resistor RT to the GNDpin 208. Because the resistor R4 is designed to have large resistance,the current on this current path can be limited to be a safe value (e.g.less than 25 mA), and the connector 128 may not suffer an overheatingproblem. In addition, the transistor Q1 is turned on when the charger124 and/or the controller 122 confirm that the connector 128 is safe.

In addition, in the embodiment shown in FIGS. 6-8, the voltage detector222 determines whether the connector 128 has an abnormal status bydetecting the voltage level of the D+ pin 204. A person skilled in theart should understand, however, that the voltage detector 222 may alsodetect the voltage level of the D− pin 204 to judge if a foreign objectis between the VBUS pin 202 and the D− pin 206. In addition, when theconnector 128 complies with the USC type-C standard, the voltagedetector 222 may also detect the voltage level of any one of thenon-power pins such as TX1, CC1, SBU1, RX2-, RX1-, SBU2, CC2, TX2- tojudge if a foreign object is between the power pin and non-power pin.These alternative designs shall fall within the scope of the presentinvention.

In the above-mentioned embodiments, both the leakage current path(caused by the resistor R1) between the VBUS pin 202 and the GND pin 208and the leakage current path (caused by the resistor R2) between theVBUS pin 202 and the D+ pin 204 can be detected. The user can then benotified if the connector 128 has any abnormal status. In otherembodiments, however, the electronic device 120 may be designed toimplement only a portion of the circuits shown in FIG. 2 to execute oneof the embodiments shown in FIG. 4 and FIG. 7 only. These alternativedesigns shall fall within the scope of the present invention.

In addition, in the embodiments shown in FIGS. 3-5, the charger 124periodically (e.g. every minute, ten minutes or hour) enters the firstself-test mode no matter whether the AC/DC adapter 110 is coupled to theconnector 128 of the electronic device 120 or not. In other embodiments,however, the charger 124 may enter the first self-test mode according toan arranged schedule or by the user's input/control, or the charger 124may enter the first self-test mode only when no cable plugs into theconnector 128, or the charger 124 may enter the first self-test modeonly when the AC/DC adapter 110 is coupled to the connector 128.Similarly, in the embodiments shown in FIGS. 6-8, the charger 124 alsoperiodically (e.g. every minute, ten minutes or hour) enters the secondself-test mode no matter whether the AC/DC adapter 110 is coupled to theconnector 128 of the electronic device 120 or not. In other embodiments,however, the charger 124 may enter the second self-test mode accordingto an arranged schedule or by the user's input/control, or the charger124 may enter the second self-test mode only when no cable plugs intothe connector 128, or the charger 124 may enter the second self-testmode only when the AC/DC adapter 110 is coupled to the connector 128.These alternative designs shall fall within the scope of the presentinvention.

In addition, the above-mentioned first self-test mode and the secondself-test mode can be sequentially executed, or be executedindependently according to an arranged schedule or by the user'sinput/control.

Briefly summarized, in the embodiments of the present invention, theleakage current caused by the connector can be exactly determined. Theuser can therefore be notified to deal with this case, or the electronicdevice can communicate with the power adapter or USB host to disable orreduce the output voltage/current, thereby avoiding overheating of theconnector.

Those skilled in the art will readily observe that numerousmodifications and alterations of the device and method may be made whileretaining the teachings of the invention. Accordingly, the abovedisclosure should be construed as limited only by the metes and boundsof the appended claims.

What is claimed is:
 1. An electronic device, comprising: a connector,arranged for coupling to a power supply external to the electronicdevice, wherein the power supply is arranged to provide a supply voltageto the electronic device to charge a battery of the electronic device;and a charger, coupled to the connector and selectively operated in anormal mode or a self-test mode, wherein when the charger operates inthe normal mode, the charger is arranged for receiving the supplyvoltage via a power pin of the connector to charge the battery of theelectronic device; and when the charger operates in the self-test mode,the charger provides a specific voltage to the power pin of theconnector; wherein the charger includes a detector to detect the currentor voltage of at least one pin of the connector to generate a detectingresult, and the supply voltage is set based on the detecting result. 2.The electronic device of claim 1, wherein when the detecting result iswithin a first range, the supply voltage is set to be a first value. 3.The electronic device of claim 1, wherein when the detecting result iswithin a second range, the supply voltage is set to be 5V.
 4. Theelectronic device of claim 1, wherein when the detecting result iswithin a third range, the supply voltage is set to be in a range between0 and 5V.
 5. The electronic device of claim 1, wherein when thedetecting result is above a first threshold, the supply voltage is setto be 0V.
 6. The electronic device of claim 1, wherein the charger isallowed to operate in the self-test mode no matter whether the connectoris coupled to the power supply or not.
 7. The electronic device of claim1, wherein the specific voltage is greater than the supply voltageprovided by the power supply.
 8. The electronic device of claim 1,further comprising: a resistor, coupled between the charger and theconnector; and a current detector, wherein when the charger operates inthe self-test mode and provides the specific voltage to the power pin ofthe connector, the current detector detects a current flowing throughthe resistor to generate the detecting result.
 9. The electronic deviceof claim 8, wherein when the current flowing through the resistor islower than a second threshold, the charger switches from the self-testmode to the normal mode; and when the current flowing through theresistor is greater than the second threshold, the current detectornotifies a controller of the electronic device to show a warningmessage, noise, or vibration or to notify the power supply to disablethe supply voltage or reduce an output current, wherein the firstthreshold may be different from the second threshold.
 10. The electronicdevice of claim 1, further comprising: a voltage detector, for detectinga voltage of a non-power pin of the connector to generate the detectingresult when the specific voltage is supplied to the power pin of theconnector; wherein when the voltage of the non-power pin is greater thana second threshold, the voltage detector notifies a controller of theelectronic device to show a warning message, noise, or vibration or tonotify the power supply to disable or reduce the supply voltage or anoutput current, wherein the first threshold may be different from thesecond threshold.
 11. The electronic device of claim 1, furthercomprising: a transistor, having a gate electrode, a first electrode anda second electrode, wherein the gate electrode is controlled by acontrol signal provided by the charger, the first electrode is coupledto a ground pin of the connector, and the second electrode is coupled toa ground of the electronic device; and a resistor, coupled between theground pin of the connector and the ground of the electronic device. 12.The electronic device of claim 11, wherein a default status of thetransistor is off, and the electronic device further comprises: avoltage detector, for detecting a voltage of a non-power pin of theconnector to generate a detecting result when the specific voltage issupplied to the power pin of the connector; wherein when the voltage ofthe non-power pin is greater than a second threshold, the voltagedetector notifies a controller of the electronic device to show awarning message, noise, or vibration or to notify the power supply todisable or reduce the supply voltage or an output current; and when thevoltage of the non-power pin is less than the second threshold, thecharger sends the control signal to turn on the transistor, wherein thefirst threshold may be different from the second threshold.
 13. Acharger, arranged to be positioned in an electronic device and coupledto a connector of the electronic device, wherein the connector isarranged for coupling to a power supply external to the electronicdevice, and the charger is selectively operated in a normal mode or aself-test mode; wherein when the charger operates in the normal mode,the charger is arranged for receiving a supply voltage from the powersupply via a power pin of the connector to charge a battery of theelectronic device; and when the charger operates in the self-test mode,the charger provides a specific voltage to the power pin of theconnector, wherein the charger includes a detector to detect the currentor voltage of at least one pin of the connector to generate a detectingresult, and the supply voltage is set based on the detecting result. 14.The charger of claim 13, wherein when the detecting result is within afirst range, the supply voltage is set to be a first value.
 15. Thecharger of claim 13, wherein when the detecting result is within asecond range, the supply voltage is set to be 5V.
 16. The charger ofclaim 13, wherein when the detecting result is within a third range, thesupply voltage is set to be in a range between 0 and 5V.
 17. The chargerof claim 13, wherein when the detecting result is above a firstthreshold, the supply voltage is set to be 0V.
 18. The charger of claim13, wherein the charger is allowed to operate in the self-test mode nomatter whether the connector is coupled to the power supply or not. 19.The charger of claim 13, wherein the specific voltage is greater thanthe supply voltage provided by the power supply.
 20. The charger ofclaim 13, further comprising: a voltage detector, for detecting avoltage of a non-power pin of the connector to generate the detectingresult when the specific voltage is provided to the power pin of theconnector; wherein when the voltage of the non-power pin is greater thana second threshold, the voltage detector notifies a controller of theelectronic device to show a warning message, noise, or vibration or tonotify the power supply to disable or reduce the supply voltage or anoutput current, wherein the first threshold may be different from thesecond threshold.
 21. An electronic device, comprising: a connector,arranged for coupling to a power supply external to the electronicdevice, wherein the power supply is arranged to provide a supply voltageto the electronic device to charge a battery of the electronic device; acharger, coupled to the connector and selectively operated in a normalmode or a self-test mode, for receiving the supply voltage via a powerpin of the connector to charge the battery when the charger operates inthe normal mode; a transistor, having a gate electrode, a firstelectrode and a second electrode, wherein the gate electrode iscontrolled by a control signal provided by the charger, the firstelectrode is coupled to a ground pin of the connector, and the secondelectrode is coupled to a ground of the electronic device; and aresistor, coupled between the ground pin of the connector and the groundof the electronic device; wherein when the charger operates in theself-test mode, the charger provides a specific voltage to the power pinof the connector, the charger includes a detector to detect the currentor voltage of at least one pin of the connector to generate a detectingresult, and the supply voltage is set based on the detecting result. 22.The electronic device of claim 21, wherein a default status of thetransistor is off, and the electronic device further comprises: avoltage detector, for detecting a voltage of a non-power pin of theconnector to generate the detecting result when the specific voltage issupplied to the power pin of the connector; wherein when the voltage ofthe non-power pin is greater than a second threshold, the voltagedetector notifies a controller of the electronic device to show awarning message, noise, or vibration or to notify the power supply todisable the supply voltage or reduce an output current; and when thevoltage of the non-power pin is less than the second threshold, thecharger sends the control signal to turn on the transistor, wherein thefirst threshold may be different from the second threshold.
 23. Theelectronic device of claim 21, wherein when the detecting result iswithin a first range, the supply voltage is set to be a first value. 24.The electronic device of claim 21, wherein when the detecting result iswithin a second range, the supply voltage is set to be 5V.
 25. Theelectronic device of claim 21, wherein when the detecting result iswithin a third range, the supply voltage is set to be in a range between0 and 5V.
 26. The electronic device of claim 21, wherein when thedetecting result is above a threshold, the supply voltage is set to be0V.